<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:aw="clr-namespace:Assergs.Windows"
	>

    <Style x:Key="CheckBoxFocusVisualStyle">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Border
						CornerRadius="2.5"
						BorderBrush="#F6CF57"
						BorderThickness="2"
						/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <SolidColorBrush x:Key="ForegroundBrush" Color="{x:Static aw:CheckBoxPallet.Foreground}"/>
    <SolidColorBrush x:Key="NormalBorderBrush" Color="{x:Static aw:CheckBoxPallet.NormalBorder}"/>
    <SolidColorBrush x:Key="NormalbackgroundBrush" Color="{x:Static aw:CheckBoxPallet.Normalbackground}"/>
    <SolidColorBrush x:Key="MouseOverBorderBrush" Color="{x:Static aw:CheckBoxPallet.NormalBorder}"/>
    <SolidColorBrush x:Key="InternalNormalBorderBrush" Color="{x:Static aw:CheckBoxPallet.InternalNormalBorder}"/>
    <SolidColorBrush x:Key="HightLightInternalBorderBrush" Color="{x:Static aw:CheckBoxPallet.HightLightInternalBorder}"/>
    
    <SolidColorBrush x:Key="DisabledForegroundBrush" Color="{x:Static aw:CheckBoxPallet.DisabledForeground}"/>
    <SolidColorBrush x:Key="DisabledBorderBrush" Color="{x:Static aw:CheckBoxPallet.DisabledBorder}"/>
    <SolidColorBrush x:Key="DisabledInternalBorderBrush" Color="{x:Static aw:CheckBoxPallet.DisabledInternalBorder}"/>
        
    <LinearGradientBrush x:Key="InternalNormalBackgroungBrush" StartPoint="0,0" EndPoint="1,1">
        <GradientStop Color="{x:Static aw:CheckBoxPallet.InternalNormalBackgroung1}" Offset="0"/>
        <GradientStop Color="{x:Static aw:CheckBoxPallet.InternalNormalBackgroung2}" Offset="0.7"/>
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="InternalHighLightBackgroungBrush" StartPoint="0,0" EndPoint="1,1">
        <GradientStop Color="{x:Static aw:CheckBoxPallet.InternalHighLightBackgroung1}" Offset="0"/>
        <GradientStop Color="{x:Static aw:CheckBoxPallet.InternalHighLightBackgroung2}" Offset="0.8"/>
    </LinearGradientBrush>

    <Style x:Key="{x:Type CheckBox}" TargetType="CheckBox">
        <Setter Property="SnapsToDevicePixels" Value="true"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource CheckBoxFocusVisualStyle}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="CheckBox">
                    <BulletDecorator Background="Transparent">
                        <BulletDecorator.Bullet>
                            <Grid>
                                <Border x:Name="Border"
                                  Width="13"
                                  Height="13"
                                  CornerRadius="0"
                                  Background="{StaticResource NormalbackgroundBrush}"
                                  BorderThickness="1"
                                  BorderBrush="{StaticResource NormalBorderBrush}">
                                    <Border x:Name="InternalBorder"
                                        Width="9"
                                        Height="9"
                                        CornerRadius="0"
                                        Background="{StaticResource InternalNormalBackgroungBrush}"
                                        BorderThickness="1"
                                        BorderBrush="{StaticResource InternalNormalBorderBrush}">
                                    </Border>
                                </Border>

                                <Path
                                  Width="9" Height="9"
                                  x:Name="CheckMark"
                                  SnapsToDevicePixels="False"
                                  Stroke="{StaticResource ForegroundBrush}" 
                                  StrokeThickness="2"
                                  HorizontalAlignment="Center"
                                  VerticalAlignment="Center"
                                  Data="M 1 5 L 4 8 L 8 1" />

                            </Grid>
                        </BulletDecorator.Bullet>
                        <ContentPresenter Margin="4,0,0,0"
                          VerticalAlignment="Center"
                          HorizontalAlignment="Left"
                          RecognizesAccessKey="True"/>
                    </BulletDecorator>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="false">
                            <Setter TargetName="CheckMark" Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="IsChecked" Value="{x:Null}">
                            <Setter TargetName="CheckMark" Property="Data" Value="M 1 8 L 8 0" />
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="InternalBorder" Property="BorderBrush" Value="{StaticResource HightLightInternalBorderBrush}" />
                            <Setter TargetName="InternalBorder" Property="Background" Value="{StaticResource InternalHighLightBackgroungBrush}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <!--<Setter TargetName="Border" Property="Background" Value="{StaticResource DisabledBackgroundBrush}" />-->
                            <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource DisabledBorderBrush}" />
                            <!--<Setter TargetName="InternalBorder" Property="Background" Value="{StaticResource DisabledBackgroundBrush}" />-->
                            <Setter TargetName="InternalBorder" Property="BorderBrush" Value="{StaticResource DisabledInternalBorderBrush}" />
                            <Setter TargetName="CheckMark" Property="Stroke" Value="{StaticResource DisabledForegroundBrush}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>